<!--<html manifest="index.appcache">-->
<html >
    <head>
        <meta name="viewport" content="user-scalable=no, width=device-width"/>
        <meta name="viewport" content="width=device-width, initial-scale=1"> 
        <link rel="stylesheet" href="css/jquery.mobile-1.4.4/jquery.mobile-1.4.4.min.css">
        <link rel="stylesheet" href="css/jquery.mobile-1.4.4/jquery.mobile.structure-1.4.4.min.css">
        <link rel="stylesheet" href="css/jquery.mobile-1.4.4/jquery.mobile.inline-png-1.4.4.min.css">
        <link rel="stylesheet" href="css/jquery.mobile-1.4.4/jquery.mobile.inline-svg-1.4.4.min.css">
        <link rel="stylesheet" href="css/jquery.mobile-1.4.4/jquery.mobile.external-png-1.4.4.min.css">
        <!-- Choix du thème -->
        <link rel="stylesheet" href="css/bootstrap/bootstrap.min.css">
        <link rel="stylesheet" href="css/bootstrap/jquery.mobile.icons.min.css">
        <link rel="stylesheet" href="css/css_aly.css">
        <!-- JavaScript -->
        <script src="js/jquery-1.11.1.min.js"></script>
        <script src="js/jquery.mobile-1.4.4.min.js"></script>
        <title>Accueil</title>
    </head>
    <body>
        <?php
        session_start();
        $idUser = $_SESSION["id"];
        ?>
        <div data-role="page">
            <div data-role="header" class="header">
                <br>
                <a  href="Tache.php?idProj=0" data-transition="slide"> 
                    <img src="img/notification32px.png" width="14px" height="14px"/>
                </a>

                <a id="buttonDeconnexion" data-transition="slide" > 
                    <img src="img/deconnexion32px.png" width="14px" height="14px" /> 
                </a>

                <div style="text-align: center;" >
                    <?php if (isset($_SESSION['fid'])): ?>
                        <img width="100px" height="100px" border="1" src="https://graph.facebook.com/<?= $_SESSION["fid"] ?>/picture?type=large">

                    <?php else: ?>
                        <img width="100px" height="100px" border="1" src="<?= $_SESSION["photo"] ?>">
                    <?php endif ?>
                    <p style="text-align: center;" >  <?= $_SESSION['prenom'] ?> </p>
                </div>

            </div>
            <div data-role="content">

                <?php
                require_once '../controller/CategorieManager.php';
                require_once '../controller/AbonProjetManager.php';
                require_once '../controller/StageManager.php';
                require_once '../controller/AbonExamenManager.php';
                include_once '../model/config.php';
                $manager = new CategorieManager($bdd);
                $list = $manager->getListCategorie();
                $manager3 = new AbonProjetManager($bdd);
                $manager4 = new AbonExamenManager($bdd);
                 $manager5 = new StageManager($bdd);
                foreach ($list as $categorie) {
                    $idCat = $categorie->getIdCategorie();
                    $libelle = $categorie->getlibelleCategorie();
                    if ($idCat == 1) {
                        $nb = $manager3->getCount($idUser);
                        echo"<a href='Projet.php' data-role='button'>$libelle<span class='ui-li-count'>$nb</span></a>";
                    }
                    if ($idCat == 2) {
                        $nb = $manager4->getCount($idUser);
                        echo"<a href='examen.php' data-role='button'>$libelle<span class='ui-li-count'>$nb </span></a>";
                    }
                    if ($idCat == 3) {
                        $idProjet = 2;
                        $nb = $manager5->getCount($idUser);
                        echo"<a href='stage.php' data-role='button'>$libelle<span class='ui-li-count'>$nb </span></a>";
                    }
                }
                ?>

            </div>
            <div data-role="footer" data-theme="e"data-position="fixed" >
                <h3> &copy INSA TOULOUSE</h3>
            </div>

        </div>
        <script>
        
        $(document).ready(function(){
            $("#fb").bind( "tap", function(e) {
                window.location="../controller/facebook.php";
            });
    
            $("#gg").bind( "tap", function(e) {
                window.location="../controller/google.php";    
            });
    
            $("#buttonDeconnexion").bind( "tap", function(e) {
                window.location="../view/deconnexion.php";    
            });
         });

    function getTaches(idProjet){
            window.location = "Tache.php?idProj="+idProjet;
    }
    
    </script>
    </body>
</html>
